package com.wys.study.serviceb.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.codingapi.txlcn.tc.annotation.DTXPropagation;
import com.codingapi.txlcn.tc.annotation.TxcTransaction;
import com.wys.study.serviceb.entity.Account;
import com.wys.study.serviceb.mapper.AccountMapper;
import com.wys.study.serviceb.service.AccountService;

/**
 * @author wuyanshen
 * @date 2020-03-13 6:13 涓嬪崍
 * @discription 鎻忚堪
 */
@Component
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountMapper accountMapper;

    @Override
    @TxcTransaction(propagation = DTXPropagation.SUPPORTS)
    @Transactional
    public String update(Account account) {
        int r = accountMapper.update(account.getMoney(),account.getUsername());
        if(true) {
        	throw new RuntimeException("123");
        }
        return r > 0 ? "success":"fail";
    }
}
